home *** CD-ROM | disk | FTP | other *** search
Wrap
; This is a listing of the Windows Batch file used to install Command Post ; This file is not runable as is. It has been compiled into INSTALL.EXE ; by the PubTech BatchWorks Compiler, to be released in the summer of 1990 instver=712 ; INSTALL VERSION NUMBER IgnoreInput(@TRUE) ;disable keyboard/mouse input source=DirGet() ;Cet current directory WriteTitle="Command Post Notes" ;Title for Write Window ro=@FALSE ;readonly error=FALSE StartCP=@FALSE ;don't start CP disktemp=environ("TEMP") if strlen(disktemp)==0 then disktemp="C:\" ;for HISTORY.TXT if install bombs a=WinVersion(1) ;Check Windows Version altshell="PROGMAN.EXE" ;Set default shell altclass="Progman" ;shell class name (techie stuff) if a==3 then winver="3XX" ;PIF file suffix for Win 3.0 if a==3 then goto gotver altshell="MSDOS.EXE" ;Set def shell for Windows 2.x altclass="Session" ;shell class name a=strupper(iniread("WIN386","ALTTAB","ZYX")) ;Are we in WIN 2.x 386 if a=="ZYX" then winver="2X2" ;Probably not if a=="ZYX" then goto gotver winver="2X3" ;Prolly in WIN 2.x 386 :gotver cr=strcat(num2char(13),num2char(10)) ;Make a CRLF tab=num2char(9) ;Make a TAB CPI="Command Post Installation" ;Default Box title instdir="\CP-NOTES.TMP" ;Working Directory ;Introductory messages Pause(CPI,"This is the Command Post%cr%installation procedure Ver %instver%.%cr%%cr%This install procedure was%cr%developed using%cr%PubTech« BatchWorks«.") a=FileLocate(altshell) ;Locate Alternate shell if a!="" then goto MSOK ;Can we find one??? Message(CPI,"Error: File %altshell% not found in PATH,%cr%cannot use this installation program.") goto crash ;Apparently not...exit :MSOK ;Found alt shell a=FileLocate("notepad.exe") ;Locate Notepad editor if a!="" then goto NOTEOK ;Found Notepad? Message(CPI,"Error: File NOTEPAD.EXE not found in PATH,%cr%cannot use this installation program.") goto crash ;Apparently not...exit :NOTEOK ;Found Notepad a=FindWindow(altclass) ;Is alternate shell running (techie stuff here) if a=="" then run(altshell,"") ;If not, run alternate shell RunZoom("NOTEPAD.EXE","") ;Run NOTEPAD.EXE, and ZOOM it Yield Yield ;Make sure Write gets going WinTitle("Notepad",WriteTitle) ;Change WRITE title Yield WinActivate(WriteTitle) ;Activate WRITE WINDOW Clipput("Command Post Installation Notes%cr%(Using Install Ver %instver%)") ;Put text into clipboard SendKey("+{INSERT}~~") ;and paste it into write (neat huh?) WinActivate(WriteTitle) Clipput("Closing any preexisting Command Post windows.") SendKey("+{INSERT}~") ;Kill off any old Command Post's cpmax=10 ;Kill off up to 10 of them :killnext ;top of loop if cpmax!=0 then goto killcont ;if not 10 closed yet, keep trying beep ;Gee, closed 10 of em, aand there still here message("Error","Unable to terminate current Command Post.%cr%Restart Windows and retry.") goto crash ;Give up :killcont a=FindWindow("Peanuts24") ;Find a 7.0+ series CP if a == "" then goto killdone ;if no find...Must be all closed winclose(a) ;Close a 7.0+ Command Psot cpmax=cpmax-1 ;decrement counter yield ;pause a tad goto killnext ;try again :killdone if cpmax!=0 then goto killc2 ;Just like above, except close beep ;a 6.2K or previous CmdPost here Message("Error","Unable to terminate old Command Post.%cr%Please rerun install without Command Post.") goto crash :killc2 a=findwindow("CmdPostIsGreat") if a=="" then goto allclosed winclose(a) cpmax=cpmax-1 yield goto killdone :allclosed Error(@off) WinIconize("MS-DOS") Error(@CANCEL) WinActivate(WriteTitle) ;Write sumore stuff to WRITE Clipput("All CmdPost windows closed. Checking for target directory.") SendKey("+{INSERT}~") :redotarget path=strcat(strupper(environ("PATH")),";") ;Get DOS PATH target=filelocate("cmdpost.exe") ;Find existing CmdPost, if any if target=="" then target=filelocate("WIN.INI") ;No find? Try find WIN.INI a=strindex(target,"\",0,@BACKSCAN) ;find final forwardslash if a!=0 then target=strsub(target,1,a) ;peel off directory ;Query for target directory target1=strupper(askLine("CmdPost Installation","Enter directory to install CmdPost into",target)) if target1!="" then target=target1 a=strlen(target) ;remove possible final \ if a<5 then goto next1 if strsub(target,a,1)=='\' then target=strsub(target,1,a-1) :next1 ;Is directory specified in PATH target=strcat(target,";") a=strindex(path,target,0,@FWDSCAN) if a!=0 then goto okpath message("Attention","Directory specified not defined in PATH statement.%cr%CmdPost MUST be in a directory in the PATH") goto redotarget ;try again. Gotta be in path!! :okpath ;OK, we like target directory WinActivate(WriteTitle) Clipput("Command Post installing to %target%.") SendKey("+{INSERT}~") a=strsub(target,1,1) ;Make sure target is not a floppy!! if a=="A" then goto flop if a=="B" then goto flop goto okpath2 :flop Message("CmdPost Install Error","Cannot install to a floppy") goto allclosed :okpath2 ;add final \ to dirname EXCEPT for X:\ case a=strlen(target) target=strsub(target,1,a-1) if a>4 then strcat(target,"\") Error(@OFF) ;Disable low-level errors WinActivate(WriteTitle) Clipput("Deleting old version of Command Post, if any.") SendKey("+{INSERT}~") a="CMDPOST.EXE" ;Set var a to a file name ret="zz1" goto DelFile :zz1 ;Ditto, See above.... a="CP_BLNK.EXE" ret="zz2" goto DelFile :zz2 a="CP_DLL.EXE" ret="zz3" goto DelFile :zz3 a="CP_DLL3.EXE" ret="zz4" goto DelFile :zz4 a="CP_INFO.EXE" ret="zz5" goto DelFile :zz5 a="CP_TREE.EXE" ret="zz6" goto DelFile :zz6 a="WININFO.EXE" ret="zz7" goto DelFile :zz7 a="cmdlib2.exe" ret="zz8" goto DelFile :zz8 a="cmdlib.exe" ret="zz9" goto DelFile :zz9 a="cmdtree.exe" ret="zz10" goto DelFile :zz10 a="cp_help.crd" ret="zzbrow" goto DelFile :zzbrow a="browser.exe" ret="zz11" goto DelFile :zz11 ;Applets delete section here ;See if applets installed a=FileLocate("}PLACE.EXE") b=FileLocate("}DELETE.EXE") c=FileLocate("}COPY.EXE") a=strcat(a,b,c) if a=="" then goto deltxt1 ;if a=="" applets apparently not here ;Applets found, ask about delete ;Most people, this would be OK, cept ;some people use them in W4W or EXCEL macros a=AskYesNo(CPI,"Applets detected on system. The new Command Post%cr%supercedes Applets. Do you%cr%wish to delete the Applet files?") if a==@NO then goto deltxt2 ; Skip delete of Applets a = "}ARRANGE.EXE" ;See file deletion comments way way ret="zz12" goto DelFile :zz12 a = "}BEEP.EXE" ret="zz13" goto DelFile :zz13 a = "}CLOSALL.EXE" ret="zz14" goto DelFile :zz14 a = "}CLOSE.EXE" ret="zz15" goto DelFile :zz15 a = "}COPY.EXE" ret="zz16" goto DelFile :zz16 a = "}DELETE.EXE" ret="zz17" goto DelFile :zz17 a = "}HIDE.EXE" ret="zz18" goto DelFile :zz18 a = "}ICONIZE.EXE" ret="zz19" goto DelFile :zz19 a = "}MOVE.EXE" ret="zz20" goto DelFile :zz20 a = "}NOP.EXE" ret="zz21" goto DelFile :zz21 a = "}PLACE.EXE" ret="zz22" goto DelFile :zz22 a = "}RENAME.EXE" ret="zz23" goto DelFile :zz23 a = "}SAY.EXE" ret="zz24" goto DelFile :zz24 a = "}SAYBEEP.EXE" ret="zz25" goto DelFile :zz25 a = "}SAYFILE.EXE" ret="zz26" goto DelFile :zz26 a = "}SHOW.EXE" ret="zz27" goto DelFile :zz27 a = "}ZOOM.EXE" ret="zz28" goto DelFile :zz28 a = "}RUN1ST.EXE" ret="zz29" goto DelFile :deltxt1 ;Delete old DOC files, if any here...below :zz29 a = "APPLETS.TXT" ret="zz30" goto DelFile :deltxt2 :zz30 a = "BROWSER.TXT" ret="zz31" goto DelFile :zz31 a = "CMDPOST.TXT" ret="zz32" goto DelFile :zz32 ;TaDaa....All files deleted. Error(@ON) ;Re-enable errors if ro==@TRUE then goto readonly ;If readonly error flag set, goto error exit disktemp=environ("TEMP") ;Locate TEMP disk space if strlen(disktemp)==0 then goto tempnull ;was TEMP defined in autoexec.bat? mydisk=strsub(disktemp,1,2) ;Peel off temp disk drive goto tempgot ;Got a temporary drive' :tempnull ;Hmmm not temp drive, well use C: then. mydisk="C:" :tempgot ;Got the temp drive... disktemp=strcat(mydisk,instdir) ;Build temp install path disktemp=AskLine(CPI,"Enter pathname to working directory.%cr%Must have 600K bytes available on disk.%cr%All files in specified directory will be deleted.",disktemp) disktemp=strtrim(strupper(disktemp)) a=strlen(disktemp) if a<3 then goto tempgot if strsub(disktemp,2,1)!=":" then goto tempgot if a<5 then goto tempgot1 if strsub(disktemp,a,1)=="\" then disktemp=strsub(disktemp,1,a-1) :tempgot1 mydisk=strsub(disktemp,1,2) instdir=strsub(disktemp,3,strlen(disktemp)-2) WinActivate(WriteTitle) Clipput("Using %disktemp% on %mydisk% as temporary/documentation directory.") SendKey("+{INSERT}~") logdisk(mydisk) ;Log to temp disk error(@OFF) DirMake(instdir) ;Create temp directory LastError=0 DirChange(disktemp) if LastError==0 then goto dircont WinActivate(WriteTitle) Clipput("%disktemp% seems to be an invalid path/directory") SendKey("+{INSERT}~") error(@CANCEL) goto crash :dircont error(@CANCEL) WinActivate(WriteTitle) ;Delete files in temp directory Clipput("Deleting all files in %disktemp%") SendKey("+{INSERT}~") Error(@OFF) ;Delete files in temp directory FileDelete(strcat(disktemp,"\*.*")) Error(@ON) dirchange(source) ;Change to source directory WinActivate(WriteTitle) Clipput("Copying CP_INST.SFX, a self-extracting compressed file, to %disktemp%.") SendKey("+{INSERT}~") FileCopy("cp_inst.sfx",strcat(disktemp,"\cp_inst.exe")) WinActivate(WriteTitle) Clipput("Copying LICENSE.TXT to %disktemp%.") SendKey("+{INSERT}~") FileCopy("license.txt",strcat(disktemp,"\license.txt")) WinActivate(WriteTitle) Clipput("Copying README.1ST to %disktemp%.") SendKey("+{INSERT}~") FileCopy("readme.1st",strcat(disktemp,"\readme.1st")) WinActivate(WriteTitle) Clipput("Copying CP_QUEST.CRD, a Q&A cardfile to %disktemp%.") SendKey("+{INSERT}~") FileCopy("cp_quest.crd",strcat(disktemp,"\cp_quest.crd")) WinActivate(WriteTitle) Clipput("Generating CP_INST.PIF to run CP_INST.EXE.") SendKey("+{INSERT}~") ;Copying PIF file to temp directory FileCopy("CP_INST.%winver%",strcat(disktemp,"\cp_inst.pif")) dirchange(disktemp) ;change dir to temp directory WinActivate(WriteTitle) Clipput("Running CP_INST.EXE to extract files.") SendKey("+{INSERT}~") run("%disktemp%\cp_inst.exe","") ;run the SFX file.... WinWaitCls("Command Post Install") ;Wait 'till SFX done.... WinActivate(WriteTitle) ;Clean up a tad Clipput("Deleting CP_INST.PIF and CP_INST.EXE.") SendKey("+{INSERT}~") FileDelete("CP_INST.PIF") FileDelete("CP_INST.EXE") ;Show message about Licensing policy. Message(CPI,"The Command Post licensing policy follows.%cr%Please read carefully.%cr%Close Notepad when done.") runzoom("notepad.exe","license.txt") ;Notepad on licensing policy. IgnoreInput(@OFF) ;Allow user to close notepad. WinWaitCls("Notepad - LICENSE.TXT") ;Wait till notepad closed. IgnoreInput(@ON) ; disable keyboard ;Does user agree??? a=AskYesNo(CPI,"Do you agree to abide by the Command Post licensing agreement") if a==@YES then goto abide ;If yes, what a swell guy... Message(CPI,"Installation terminated") ;NO? Well this install is OVER! WinActivate(WriteTitle) ;Move help cardfile Clipput("Licensing agreement not accepted.") SendKey("+{INSERT}~") Clipput("Installation process terminated.") SendKey("+{INSERT}~") goto crash ;exit :abide ;Agrees with license policy WinActivate(WriteTitle) Clipput("Licensing agreement accepted. Installation continuing.") SendKey("+{INSERT}~") FileRename("taskmanr.exe","taskmanr.rpl") ;Hide taskmanr.exe from FileMove below WinActivate(WriteTitle) Clipput("Moving EXE files from %disktemp% to %target%.") SendKey("+{INSERT}~") Error(@OFF) FileMove("*.exe",strcat(target,"\*.*")) ;Move all EXE file (cept taskmanr) Error(@CANCEL) FileRename("taskmanr.rpl","taskmanr.exe") ;Restore taskmanr WinActivate(WriteTitle) ;Move help cardfile Clipput("Moving CP_HELP.CRD file from %disktemp% to %target%.") SendKey("+{INSERT}~") FileMove("CP_HELP.CRD",strcat(target,"\*.*")) WinActivate(WriteTitle) ;Move help cardfile Clipput("Copying CP_VIRT.BAT file from %disktemp% to %target%.") SendKey("+{INSERT}~") FileCopy("CP_VIRT.BAT",strcat(target,"\*.*")) dirchange(target) ;Change to target directory user=FileLocate("CMDUSER.CPM") ;scout around for cmduser.cpm post=FileLocate("CMDPOST.CPM") ;scout around for cmdpost.cpm dirchange(disktemp) ;back to temp directory ;If no cmduser.cpm, use ours. if user=="" then FileCopy("CMDUSER.CPM",strcat(target,"\*.*")) if user=="" then Clipput("CMDUSER.CPM user menu file installed.") ;If cmduser.cpm found NO TOUCH!! if user!="" then Clipput("CMDUSER.CPM user menu file found, NOT overwritten.") WinActivate(WriteTitle) SendKey("+{INSERT}~") ;If no cmdpost.cpm, install ours if post=="" then FileCopy("CMDPOST.CPM",strcat(target,"\*.*")) if post=="" then clipput("CMDPOST.CPM master default menu installed.") if post=="" then goto cpmdid ;CmdPost.cpm found. Ask about it a=AskYesNo(CPI,"Do you wish to replace your CMDPOST.CPM file%cr%with our latest version?") clipput("CMDPOST.CPM file found. NOT replaced, per your direction.") if a==@NO then goto cpmdid ;If no, don't replace c=strlen(post) ;build name of x:\xxx\xxx\cmdpost.old postx=strsub(post,1,c-3) postx=strcat(postx,"OLD") Error(@OFF) FileDelete(postx) ;Delete cmdpost.old if found Error(@CANCEL) FileRename(post,postx) ;rename cmdpost.cpm to cmdpost.old FileCopy("CMDPOST.CPM",post) ;Copy out file to cmdpost.cpm clipput("%post% file updated with new version.%cr%Old Version renamed to %postx%") :cpmdid ;CPM file mashing complete. WinActivate(WriteTitle) SendKey("+{INSERT}~") ;Fixup WIN.INI ;Remove CmdPost from LOAD= ;Install CmdPost on RUN= a=strupper(iniread("windows","load","")) b=strupper(iniread("windows","run","")) ;remove from load line if a=="" then goto noload c=strindex(a,"CMDPOST.EXE",1,@FWDSCAN) ;Whole bunch string parsing if c==0 then goto noload front="" back="" if c==1 then goto frontok front=strsub(a,1,c-1) :frontok if strlen(a)<14 then goto backok if (c+13)>=strlen(a) then goto backok back=strsub(a,c+12,strlen(a)-c-12) :backok clipput("CMDPOST.EXE removed from load=line in WIN.INI file.") WinActivate(WriteTitle) SendKey("+{INSERT}~") iniwrite("windows","load",strcat(front," ",back)) ;re-write load= :noload if b=="" then goto addini c=strindex(b,"CMDPOST.EXE",1,@FWDSCAN) if c!=0 then goto runiniok if already on run=, everything ok :addini ;Add to run= line iniwrite("windows","run",strcat(b," CMDPOST.EXE")) clipput("CMDPOST.EXE added to run= line in WIN.INI file.") WinActivate(WriteTitle) SendKey("+{INSERT}~") :runiniok dirchange(disktemp) ;Back to temp directory. ;Windows 3.0....tell 'em about appendix if winver=="3XX" then Message(CPI,"Since you have Windows 3.0, please review%cr%the special Windows 3.0 appendix in the%cr%documentation to see how to make%cr%Command Post your primary shell and to%cr%see how to change the taskman.exe file.") IgnoreInput(@OFF) ;Allow keyboard inputs. ;Install all doned Message(CPI,"Command Post Installation Complete.%cr%Assorted documentation files may be%cr%found in the %disktemp%\ directory.%cr%%cr%If %disktemp%\ is on a RAM drive,%cr%please copy documentation files%cr%to a permanent drive before rebooting.") a=iniread("CmdPost","Info","AB2") if a=="AB2" then message(CPI,"If you have purchased a licensed%cr%copy of Command Post, please%cr%be sure to enter your license%cr%number to avoid the initial%cr%purchase solicitation messages.") Message(CPI,"The README.1ST file will be displayed%cr%Please read.%cr%Close Notepad when done.") runzoom("notepad.exe","README.1ST") ;Notepad on licensing policy. IgnoreInput(@OFF) ;Allow user to close notepad. WinWaitCls("Notepad - README.1ST") ;Wait till notepad closed. IgnoreInput(@ON) ; disable keyboard StartCP=@TRUE clipput("*** Installation completed normally ***") WinActivate(WriteTitle) SendKey("+{INSERT}~") goto History :readonly ;readonly file error exit Message(CPI,"Read-Only files found. Please reset%cr%read-only attribute before trying again.") ;drop thru to general crash exit :crash Message(CPI,"ERROR: Command Post not properly installed") Message(CPI,"Tech Support, if required, at %cr% (206) 937-9335") ;hopefully not required clipput("*** Installation abnormally terminated. ***") WinActivate(WriteTitle) SendKey("+{INSERT}~") :History WinActivate(WriteTitle) Error(@OFF) FileDelete("%disktemp%\HISTORY.TXT") Error(@CANCEL) WinActivate(WriteTitle) ;Close down Write SendKey("!FA") SendKey("%disktemp%\HISTORY.TXT~") WinClose("Notepad - HISTORY.TXT") if StartCP==@FALSE then exit Display(3,CPI,"Please wait.%cr%Command Post starting up."); dirchange(target) ;start up new Command Post. cpexe=strcat(target,"\cmdpost.exe") if FileLocate(cpexe)=="" then run("cmdpost.exe","") if FileLocate(cpexe)!="" then run(cpexe,"") exit :DelFile a=FileLocate(a) ;Locate file name in path if a=="" then goto %ret% ;if a=="" then file not found, do next one FileDelete(a) ;Delete file WinActivate(WriteTitle) ;Activate WRITE window Clipput("Deleted %a%") ;Copy "Deleted <filename>" to clipboard b=FileLocate(a) ;Check...Is file REALLY gone??? if a==b then ro=@TRUE ;if a==b, then file STILL THERE if a==b then ClipPut("*** %a% Not Deleted - Read/Only ***") ;MUST BE READ ONLY, SET ERROR SendKey("+{INSERT}~") ;Paste result to write goto %ret%